<?php

namespace App\Models\Applet\Order;

class ShopOrderAddressModel extends BaseOrderModel
{
    protected $table = 'shop_order_address';

    /**
     * 根据主订单id获取数据
     * @param int $orderMasterId
     * @param array $fields
     * @return array
     */
    public function getItemByOrderMasterId(int $orderMasterId, array $fields = self::QUERY_DEFAULT_FIELDS): array
    {
        $result = $this->select($fields)
                       ->where('order_master_id', $orderMasterId)
                       ->first();
        return $result ? $result->toArray() : [];
    }
}
